import request from '../utils/request'


// 考试相关接口
export const examApi = {
    // 获取考试列表
    getExamPage: (data) => request({
        url: '/exam/exam/page',
        method: 'post',
        data
    }),
    // 创建考试
    createExam: (data) => request({
        url: '/exam/exam',
        method: 'post',
        data
    }),
    // 获取考试详情
    getExam: (id) => request({
        url: `/exam/exam/${id}`,
        method: 'get'
    }),
    // 更新考试
    updateExam: (data) => request({
        url: '/exam/exam',
        method: 'put',
        data
    }),
    // 删除考试
    deleteExam: (id) => request({
        url: `/exam/exam/${id}`,
        method: 'delete'
    }),
    // 获取考试结果
    getExamResults: (examId) => request({
        url: `/exam/exam-result/${examId}/results`,
        method: 'get'
    }),
    // 获取考试信息
    getExamInfo: (id) => request({
        url: `/exam/exam/${id}/question`,
        method: 'post'
    }),
    // 报名考试
    registrationExam: (id) => request({
        url: `/exam/exam-result/${id}/registration`,
        method: 'post',
    }),
    // 提交考试
    beginExam: (id) => request({
        url: `/exam/exam-result/${id}/begin`,
        method: 'post',
    }),
    // 提交考试
    submitExam: (id) => request({
        url: `/exam/exam-result/${id}/submit`,
        method: 'put',
    }),
    // 获取考试历史
    getExamHistory: (data) => request({
        url: 'exam/exam-result/history',
        method: 'post',
        data
    }),
    // 分页获取成绩列表
    getExamScores: (data) => request({
        url: `/exam/exam-result/scores`,
        method: 'post',
        data
    }),
    // 获取某学生答题详情
    getExamAnswerDetail: (examId, resultId) => request({
        url: `/exam/exam-result/${examId}/answer/${resultId}`,
        method: 'get'
    }),
}